package com.itheima.work;

/**
 * @auther Macrydy
 * @date 2020/6/30 21:28
 */
public class Student1 implements Comparable<Student1>{
    private String name;
    private int age;
    private float score;

    @Override
    public String toString() {
        return "Student1{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", score=" + score +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public float getScore() {
        return score;
    }

    public void setScore(float score) {
        this.score = score;
    }

    public Student1(String name, int age, float score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }

    public Student1() {
    }

    @Override
    public int compareTo(Student1 o) {
        float result = o.getScore() - this.score;
        result=result==0?this.age-o.age:result;
        return (int) result;
    }
}
